package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"srv/houseclient"
)

type ServiceContext struct {
	Config          config.Config
	HouseMiddleware rest.Middleware
	HouseSrv        houseclient.House
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:          c,
		HouseMiddleware: middleware.NewHouseMiddleware().Handle,
		HouseSrv:        houseclient.NewHouse(zrpc.MustNewClient(c.HouseSrv)),
	}
}
